package com.yjha.ai.demos.web.functions;

import java.util.function.Function;

public class AddressUserFunction implements Function<AddressUserFunction.Request, AddressUserFunction.Response> {


    @Override
    public Response apply(Request request) {
        if (request.address == null || request.name == null) {
            return new Response("参数缺失，无需function-call,正常响应即可........");
        }

        System.out.println("--------------------调用了工具--------------------");

        System.out.println(request.address+"================="+request.name);

        return new Response("兰州市张三出生地甘肃平凉，今年29岁");
    }

    //密封类 负责告诉gpt要提取哪些信息，接受gpt提取后的信息
    public record Request(String address, String name) {}

    public record Response(String message) {
    }
}
